<?php 
if(!defined('ADMIN')){
	exit('Access Denied');
}
$page=1;
$pagesize=1000;
?>
<form id="pagerForm" method="post" action="#rel#">
	<input type="hidden" name="pageNum" value="<?=$page?>" />
	<input type="hidden" name="numPerPage" value="<?=$pagesize?>" />
	<input type="hidden" name="orderField" value="<?=$orderField?>" />
	<input type="hidden" name="orderDirection" value="<?=$orderDirection?>" />
</form>
<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="<?=u(MOD,'modelfield')?>&id=<?=$id?>" method="post">
</form>
<div class="pageHeader">
	<p><b>模型管理--<?=$modelinfo["title"]?>字段管理</b></p>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="<?=u(MOD,'addedifield')?>&modelid=<?=$id?>" target="dialog"><span>添加字段</span></a></li>
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids[]" href="<?=u(MOD,'delfied')?>" class="delete"><span>批量删除</span></a></li>
			<li><a class="edit" href="<?=u(MOD,'addedifield',array('id'=>'{id}'))?>" target="dialog" warn="请选择一条记录"><span>修改</span></a></li>
			<li class="line">line</li>
            <li><a class="icon" href="<?=u(MOD,ACT,array('id'=>$id))?>" target="navTab" title="字段管理"  rel="page<?=$id?>"><span>刷新</span></a></li>
		</ul>
	</div>
<form method="post" action="<?=u(MOD,'modelfield')?>&id=<?=$id?>" rel="pagerForm"  onsubmit="return navTabSearch(this);">
<input type="hidden" name="sub" value="save" />
<input type="hidden" name="id" value="<?=$id?>" />
    
     <table class="table" width="100%" layoutH="138">
     <thead>
                    <tr>
                      <th width="3%"><input type="checkbox" group="ids[]" class="checkboxCtrl" /></th>
                      
                      <th width="5%">排序</th>
					  <th width="20%">字段名</th>
                      <th width="">别名</th>
                      <th width="10%">类型</th>
                      <th width="10%">编辑状态</th>
                      <th width="20%">管理操作</th>
                    </tr>
	</thead>
    <tbody>                    
					<?php foreach ($row as $r){?>
					  <tr target="id" rel="<?=$r["id"]?>">
                        <td class="center"><input <?php if($r['issys']==1){?>title="系统数据，不准删除"  disabled="disabled"<?php }?> type='checkbox' name='ids[]' value='<?=$r["id"]?>' /></td>
                        <td class="center"><input type="text" style="width:40px" name="listorder[<?=$r[id]?>]" value="<?=$r["listorder"]?>" /></td>
                        <td class="center"><?=$r["field"]?></td>
                        <td class="center"><?=$r["name"]?></td>
                        <td><?=$r["formtype"]?></td>

                        <td class="center"><?php
                        if($r["isadmin"]=="0"){
                            echo "可编辑";
                        }elseif($r["isadmin"]==1){
                            echo "只读";
                        }elseif($r["isadmin"]==2){
                            echo "隐藏";
                            
                        }
                        
                        ?></td>
                        
						<td class="left">
                        

                        <a title="编辑"  href="<?=u(MOD,'addedifield',array('id'=>$r['id']))?>&modelid=<?=$id?>" target="dialog" class="btnEdit">编辑</a>
                        <?php if($r['issys']!=1){?>
                        <a title="删除"<?=$r["name"]?>”字段吗？" target="ajaxTodo" href="<?=u(MOD,'delfied',array('id'=>$r['id']))?>" class="btnDel">删除</a>
                        <?}?>
                        <?php if($r['disabled']==0){?>
                            <a title="禁用“<?=$r["name"]?>”字段吗？" target="ajaxTodo" href="<?=u(MOD,'disabled',array('id'=>$r['id']))?>" class="btnDisabled">禁用</a>
                        <?}else{?>
                            <a title="启用“<?=$r["name"]?>”字段吗？" target="ajaxTodo" href="<?=u(MOD,'enable',array('id'=>$r['id']))?>" class="btnSelect">启用</a>
                         <?}?>
                        </td>
					  </tr>
					<?php }?>
                    </tbody>
                  </table>
<div class="formBar">
<ul style="float:left;">
<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保 存 设 置</button></div></div></li>
</ul>
</div>
</form>                  

</div>  
